Expand description
Utilities for encoding and decoding frames using async/await
.
Contains adapters to go from streams of bytes, AsyncRead
and AsyncWrite
, to framed streams implementing Sink
and Stream
.
Framed streams are also known as transports
.
use futures::TryStreamExt;
use futures::io::Cursor;
use futures_codec::{LinesCodec, Framed};
let io = Cursor::new(Vec::new());
let mut framed = Framed::new(io, LinesCodec);
while let Some(line) = framed.try_next().await? {
dbg!(line);
}
Structs§
- A reference counted contiguous slice of memory.
- A simple codec that ships bytes around
- A unique reference to a contiguous slice of memory.
- A codec for JSON encoding and decoding using serde_cbor Enc is the type to encode, Dec is the type to decode
- A unified
Stream
andSink
interface to an underlying I/O object, using theEncoder
andDecoder
traits to encode and decode frames. - A
Stream
of messages decoded from anAsyncRead
. - A
Sink
of frames encoded to anAsyncWrite
. - A codec for JSON encoding and decoding using serde_json Enc is the type to encode, Dec is the type to decode
- A simple
Codec
implementation sending your data by prefixing it by its length. - A simple
Codec
implementation that splits up data into lines.
Enums§
- JSON Codec error enumeration
- JSON Codec error enumeration
Traits§
- Decoding of frames via buffers, for use with
FramedRead
. - Encoding of messages as bytes, for use with
FramedWrite
.